using NUnit.Framework;
using SmartPeople.Framework.SecuritySpace;

namespace SmartPeople.Framework.SecuritySpace.Tests
{
    public class TestRoles
    {
        public const string Administrators = "Administrators";
        public const string Operators = "Operators";
        public const string Users = "Users";

        public static void CreateAllTestRoles(ISecuritySpace securitySpace)
        {
            securitySpace.Roles.CreateRole(Administrators);
            securitySpace.Roles.CreateRole(Operators);
            securitySpace.Roles.CreateRole(Users);
        }
    }

    public class TestUsers
    {
        public const string System = "system";
        public const string Administrator = "Administrator";
        public const string Guest = "Guest";
        public const string User1 = "User1";
        public const string User2 = "User2";
        public const string User3 = "User3";
        public const string User4 = "User4";
        public const string User4Password = "om2ga";
        public const string User1Email = "user1@acme.com";
        public const string User2Email = "user2@acme.com";
        public const string User1FullName = "John Doe";
        public const string User1Password = "usr1pass";
        public const string User2Password = "usr2pass";
        public const string User1Description = "normal user1";
        public const string User2Description = "normal user2";

        public static void CreateAllTestUsers(ISecuritySpace securitySpace)
        {
            securitySpace.Users.CreateUser(System, "thsystem@acme.com");
            securitySpace.Users.CreateUser(Administrator, "thadministartor@acme.com");
            securitySpace.Users.CreateUser(Guest, "thguest@acme.com");
            securitySpace.Users.CreateUser(User1, "thguest1@acme.com");
            securitySpace.Users.CreateUser(User2, "thuser2@acme.com");
            securitySpace.Users.CreateUser(User3, "thuse3@acme.com");
        }

        public static ISecurityUser CreateSampleUser1(ISecuritySpace securitySpace)
        {
            string userName = "john";
            string password = "password";
            //create user1
            ISecurityUser user1 = securitySpace.Users.CreateUser(userName, password);

            //check if user created
            Assert.IsNotNull(user1);
            Assert.AreEqual(user1.UserName, securitySpace.Users.GetUser(user1.UserName).UserName);
            Assert.AreEqual(1, securitySpace.Users.Count);

            //add additional details
            user1.Email = "johndoe@acme.com";
            user1.FullName = "John Doe";
            user1.Description = "Normal User";
            securitySpace.Users.UpdateUser(user1);
            return user1;
        }
    }

    public class TestSecuredTypes
    {
        public const string Folder = "folder";
        public const string UnknownFileType = "unknownFileType";
    }

    public class TestActions
    {
        public const string List = "List";
        public const string Read = "Read";
        public const string Create = "Create";
        public const string Modify = "Modify";
        public const string Delete = "Delete";

        public const string Get = "Get";
        public const string Set = "Set";
    }

    public class TestStates
    {
        public const string New = "New";
        public const string Normal = "Normal";
        public const string ReadOnly = "ReadOnly";
        public const string Protected = "Protected";
    }
}